package com.zhuqieli.database_learn.controller;

import com.zhuqieli.database_learn.pojo.MqMessage;
import com.zhuqieli.database_learn.service.MqService;
import com.zhuqieli.database_learn.service.UserTableService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @author: magc
 * @date: 2023/8/31 9:33
 * @version: 1.0
 */
@RestController
@Slf4j
@RequestMapping("/mq")
public class MqController {
    @Autowired
    MqService mqService;

    //拦截器测试用接口，需将@Controller改为@RestController
    @PostMapping("/downLoad")
    public void sendMessageToDownLoad(@RequestParam(value = "account") String account,
                                      @RequestParam(value = "fileId") String fileId) {
        MqMessage mqMessage = MqMessage.builder().account(account).fileId(fileId).build();
        mqService.setMessage(mqMessage);
    }
}
